<!DOCTYPE html>

<?php include "res/title.php"; ?>
<?php $push = true; ?>
<html>
<head>
	<title>GoDeal - Главная</title>
	<meta charset="UTF-8">

	<link href='http://fonts.googleapis.com/css?family=Open+Sans&subset=latin,cyrillic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" type="text/css" href="/css/style.css">
	<link rel="icon" type="image/png" href="/favicon.png" />

	<script type="text/javascript" src="/js/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="/js/client-script.js"></script>
	<script type="text/javascript" src="/js/pushed-nav-script.js"></script>
    <script src="/js/kkcountdown.min.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(function() {
		$(".kkcount-down").each(function() {
			$(this).kkcountdown({
                	dayText		: 'день ',
                	daysText 	: 'дн ',
                    hoursText	: 'ч ',
                    minutesText	: 'мин ',
                    secondsText	: 'сек',
                    displayZeroDays : false,
                    oneDayClass	: 'one-day'
            });
		});
	});
	</script>
	<script type="text/javascript" src="http://c.zero.kz/z.js"></script>
</head>
<body>



	<div class="banner-link">
		<a href="/godeal/home/partners/"><img src="/img/partners-list.png"></a>
	</div>

	<!-- Navigation -->
	<?php include "res/navigation.php"; ?>

	<div class="wrapper wrapper-pushed">
		<!-- Categories -->
		<?php include "res/categories.php"; ?>

		<!-- Right content -->
		<?php include "res/right-content.php" ?>

		<div class="container">
			<?php $n = 0;
			foreach ($adeals as $adeal) {
				$n++;
				if($n % 2 == 1) { ?>
			<div class="deal-row">
			<?php } ?> 
				<div class="deal pos<?php echo $n % 2 ?>">
					<div class="stats">
						<b>
							Купили: <?php echo count($this->coupon->getCouponByDealId($adeal->deal_id)) ?> 
							&nbsp;&nbsp;&nbsp; 
							Осталось: <span data-time="<?php echo date('U', strtotime(date('Y-m-d') .' +1 day')); ?>" class="kkcount-down"></span>
						</b>
					</div>

					<div class="deal-img">
						<a href="#" onclick="to_link(<?php echo $adeal->id.','.$session_active ?>)">
							<div class="description">
							</div>
						</a>
						<b><?php echo $adeal->sale; ?> <sup>%</sup></b>
						<img src="<?php echo $adeal->img_url ?>" alt="<?= $adeal->title ?>">
					</div>
					<?php echo $adeal->title; ?>

					<div class="info">
						<?php if($adeal->i_cost > 0) { ?>
						<div class="i_cost">
							<?php echo $adeal->i_cost; ?> тг.
						</div>
						<?php } ?>
						<div class="s_cost">
							<?php echo $adeal->s_cost; ?> тг.
						</div>
					</div>

				</div>
			<?php 
				if($n % 2 == 0) { ?>
			</div>
				<?php }
			}
			if($n % 2 == 1) { ?>
			</div>
				<?php }
			 ?>
		</div>

		<!-- Footer -->
		<?php include "res/footer.php"; ?>
	</div>
	
	<!-- Popup Login -->
	<?php include "res/popup-login.php" ?>
	<?php if($this->session->userdata('message')) { ?>
		<div class="message">
			<?php echo $this->session->userdata('message') ?>
			<p>&times;</p>
		</div>		
	<?php } 
	$array_items = array('message' => '');
	$this->session->unset_userdata($array_items);
	?>

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-41962264-1', 'godeal.kz');
  ga('send', 'pageview');

</script>

</body>
</html>